package string;

/**
 * boolean startsWith(String str)
 * 判断字符串是否以指定的字符串开头
 * boolean endsWith(String str)
 * 判断字符串是否以指定的字符串结尾
 */
public class StartsWithDemo {
    public static void main(String[] args) {
        String line = "www.tedu.cn";
        boolean starts = line.startsWith("www");
        System.out.println("starts:"+starts);
        starts = line.startsWith("http");
        System.out.println("starts:"+starts);
        starts = line.startsWith("WWW");
        System.out.println("starts:"+starts);

        boolean ends = line.endsWith("cn");
        System.out.println("ends:"+ends);
        ends = line.endsWith("com");
        System.out.println("ends:"+ends);
    }
}
